#ifndef __NODE_H__
#define __NODE_H__

#include <stddef.h>
#include "ListException.h"

namespace cs236703_spring2012_hw2
{

// nodeCount is defined in Main.cpp.
// you can use it to count the number of nodes,
// and make sure they are garbage collected properly.
extern int nodesCount;

// The Node class holds the actual data in the list.
// It should be used by the List and the Iterator,
// but not by the user of the list.
class Node
{
public:
	// Use the c'tor and d'tor to track the number of Node instances.
	Node() { nodesCount++; }
	virtual ~Node() { nodesCount--; }
	// Set the value of the node
	virtual void SetValue(int value) = 0;
	// Get the value of the node
	virtual int GetValue() const = 0;
	// Set given node as next in list
	virtual void SetNext(Node* next) = 0;
	// Get the next node in the list
	virtual Node* GetNext() const = 0;
	// Set given node as previous in list
	virtual void SetPrev(Node* prev) = 0;
	// Get the previous node in the list
	virtual Node* GetPrev() const = 0;
	// Indicate whether the node is mutable or not
	virtual bool IsImmutable() const = 0;
	// Tell the node someone is pointing to it
	virtual void AddRef() = 0;
	// Tell the node it is no longer pointed by someone
	virtual void RemoveRef() = 0;
};

}
#endif
